//
//  AppTools.m
//  LTao
//
//  Created by dllo on 16/3/11.
//  Copyright © 2016年 LT. All rights reserved.
//

#import "AppTools.h"
#import <AFNetworking.h>

@implementation AppTools
+(void)getWithAFNurl:(NSString *)url block:(AFNBLOCK)block error:(AFNErrorBLOCK)errorblock{
    
    NSString *urlEncode = [url stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
    
    AFHTTPSessionManager *session = [AFHTTPSessionManager manager];
    session.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/plain",@"text/json",@"application/json",@"text/javascript",@"text/html",nil];
    [session GET:urlEncode parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
        
        block(responseObject);
        
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        
        NSLog(@"失败");
        
    }];
    
}
@end
